package hijava;

public class ConsumerRunnable implements Runnable{

    private Storage15 storage;

    public ConsumerRunnable(Storage15 storage) {
        this.storage = storage;
    }

    private boolean sw = true;
    public void run() {
        while (sw){
            storage.subtract();
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }

    public void close(){
        this.sw = false;
    }
}
